cmake_minimum_required(VERSION 3.10)

# 忽略代码中的中文注释引起的MSVC编译器警告
if(MSVC)
    add_compile_options(/source-charset:utf-8)
    add_compile_options(/execution-charset:utf-8)
endif()

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(PROJECT_NAME "example02")
project(${PROJECT_NAME} VERSION 1.0.0)

find_package(OpenGL REQUIRED COMPONENTS OpenGL)
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Network REQUIRED)
find_package(GLEW REQUIRED)
find_package(rs_driver REQUIRED)
find_package(Poco REQUIRED COMPONENTS Foundation JSON)
find_package(VTK REQUIRED COMPONENTS InteractionStyle RenderingOpenGL2 ViewsQt)

CollectSourceFiles(${CMAKE_CURRENT_SOURCE_DIR} PRIVATE_SOURCES)
add_executable(${PROJECT_NAME} ${PRIVATE_SOURCES})

set(PCL_DIR "/home/school/lib/pcl-1.13/share/pcl-1.13")
find_package(PCL 1.13.1 REQUIRED)

target_include_directories(
    ${PROJECT_NAME} PUBLIC
    ${PCL_INCLUDE_DIRS}
    ${rs_driver_INCLUDE_DIRS}
    ${VTK_INCLUDE_DIRS}
)

link_directories(${PCL_LIBRARY_DIRS} ${VTK_LIBRARY_DIRS})

target_link_libraries(
    ${PROJECT_NAME}
    PRIVATE
    Qt5::Core
    Qt5::Gui
    Qt5::Widgets
    Qt5::Network
    OpenGL::GL
    GLEW::GLEW
    ${PCL_LIBRARIES}
    VTK::InteractionStyle
    VTK::RenderingOpenGL2
    VTK::ViewsQt
    ${rs_driver_LIBRARIES}
    Poco::Foundation
    Poco::JSON
)